/*
 * Date :  2021-03-0
 * Author ：w
 * Version ：1.6.2
 */

import request from '@/utils/request';

// 设备列表
export function getDeviceList(params) {
  return request({
    url: `/api/device/street-light/page`,
    method: `get`,
    params
  });
}

export function getDeviceAll() {
  return request({
    url: `/api/device/street-light/all`,
    method: `get`
  });
}

// 创建设备
export function createDevice(data) {
  return request({
    url: `/api/device/street-light`,
    method: `post`,
    data
  });
}

// 设备详情
export function getDevice() {
  return request({
    url: `/api/device/street-light/${data.id}`,
    method: `get`
  });
}

// 修改设备
export function updateDevice(data) {
  return request({
    url: `/api/device/street-light/${data.id}`,
    method: `put`,
    data
  });
}

// 删除设备
export function deleteDevice(id) {
  return request({
    url: `/api/device/street-light/${id}`,
    method: `delete`
  });
}

/* 路灯路线 */

// 联网单位下路灯路线
export function getLightLineByProjectId(id) {
  return request({
    url: `/api/device/device-street-light-line/allByNetworkingUnit?oid=${1}`,
    method: `get`
  });
}


// 指令下达
export function getInstructions(params) {
  return request({
    url: "/api/device/street-light/switch-page",
    method: "post",
    params
  });
}

// 项目下的报警设备
export function getFireDeviceByProject(params) {
  return request({
    url: "/api/device/deviceNetworkingUnit/getSensorList",
    method: "get",
    params
  });
}

// 根据设备id查询路灯杆的路线
export function getLinesByDeviceId(params) {
  return request({
    url: "/api/device/device-street-light-line/linesByDeviceId",
    method: "get",
    params
  });
}

// 修改火警设备的路线
export function updateLineStreeLight(data) {
  return request({
    url: "/api/device/device-street-light-line/insertLine",
    method: "post",
    data
  });
}
